package com.xc.freeapp.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.xc.freeapp.dao.UserNotificationMapper;
import com.xc.freeapp.dao.dataSource.DBContextHolder;
import com.xc.freeapp.entity.UserNotification;
@Service
public class UserNotificationService {
	@Autowired
	UserNotificationMapper userNotificationMapper;
	
	public List<UserNotification> selectByUserId(Integer userId,PageBounds pageBounds){
		DBContextHolder.switchDataSourceRW();//切换数据源
		return userNotificationMapper.selectByUserId(userId, pageBounds);
	}
	public UserNotification selectByid(Integer id){
		DBContextHolder.switchDataSourceRW();//切换数据源
		return userNotificationMapper.selectByPrimaryKey(id);
	}
	public int updateisRead(Integer id){
		DBContextHolder.switchDataSourceRW();//切换数据源
		return userNotificationMapper.updateIsRead(id);
		
	}
	public int deleteByPrimaryKey(Integer id){
		DBContextHolder.switchDataSourceRW();//切换数据源
		return userNotificationMapper.deleteByPrimaryKey(id);
	}
}
